//
//  ALUtilsMacro.h
//  ALUtils
//
//  Created by mac on 2018/4/23.
//  Copyright © 2018年 anlun. All rights reserved.
//

#ifndef ALUtilsMacro_h
#define ALUtilsMacro_h

#pragma mark -
#pragma mark 申明为单例
#undef    AL_AS_SINGLETON
#define AL_AS_SINGLETON( __class ) \
+ (__class *)sharedInstance;\

#undef    AL_DEF_SINGLETON
#define AL_DEF_SINGLETON( __class ) \
+ (__class *)sharedInstance \
{ \
static dispatch_once_t once; \
static __class * __singleton__; \
dispatch_once( &once, ^{ __singleton__ = [[__class alloc] init]; } ); \
return __singleton__; \
}


#pragma mark - color
#define AL_RGB(r, g, b)             [UIColor colorWithRed:((r) / 255.0) green:((g) / 255.0) blue:((b) / 255.0) alpha:1.0]
#define AL_RGBAlpha(r, g, b, a)     [UIColor colorWithRed:((r) / 255.0) green:((g) / 255.0) blue:((b) / 255.0) alpha:(a)]

#define AL_HexRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define AL_HexRGBAlpha(rgbValue,a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:(a)]

#pragma mark 屏幕相关
#pragma mark -
#define AL_ScreenWidth ([UIScreen mainScreen].bounds.size.width)
#define AL_ScreenHeight ([UIScreen mainScreen].bounds.size.height)
#define AL_StatusBarHeight 20.0f
#define AL_NavigationBarHeight 44.0f
#define AL_StarusBarBotom (isAfterIOS7 ? 20:0)
#define AL_NavigationBarBotom (isAfterIOS7 ? (20+44):(0+44))
#define AL_NavigationBarLandscapeHeight 33.0f
#define AL_TabBarHeight 49.0f
#define AL_ToolBarHeight 44.0f
#define AL_ContentViewHeight (kScreenHeight - kNavigationBarBotom - kTabBarHeight)

#define AL_LeftSep 10.0f
#define AL_RightSep 10.0f

#pragma mark Device
#pragma mark -
#define isIOS4 ([[[UIDevice currentDevice] systemVersion] intValue]==4)
#define isIOS5 ([[[UIDevice currentDevice] systemVersion] intValue]==5)
#define isIOS6 ([[[UIDevice currentDevice] systemVersion] intValue]==6)
#define isIOS7 ([[[UIDevice currentDevice] systemVersion] intValue]==7)
#define isIOS8 ([[[UIDevice currentDevice] systemVersion] intValue]==8)

#define isAfterIOS4 ([[[UIDevice currentDevice] systemVersion] intValue]>=4)
#define isAfterIOS5 ([[[UIDevice currentDevice] systemVersion] intValue]>=5)
#define isAfterIOS6 ([[[UIDevice currentDevice] systemVersion] intValue]>=6)
#define isAfterIOS7 ([[[UIDevice currentDevice] systemVersion] intValue]>=7)
#define isAfterIOS8 ([[[UIDevice currentDevice] systemVersion] intValue]>=8)

#define isRetina ([[UIScreen mainScreen] scale]==2)
#define isIphone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define isPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
#define CurrentSystemVersion ([[UIDevice currentDevice] systemVersion])
#define CurrentLanguage ([[NSLocale preferredLanguages] objectAtIndex:0])

#define isAfterIphone6 ([UIScreen mainScreen].bounds.size.width>=750/2)


#endif /* ALUtilsMacro_h */
